﻿using FluentValidation;
using Jupiter.Infrastructure.Domain;
using MediatR;
using Wips.AppService.Publisher.Models;
using Wips.AppService.Publisher.Requests;

namespace  Wips.AppService.Publisher.Requests
{
    /// <summary>
    /// 添加子服务相关服务配置
    /// </summary>
    public class AddOrEditAgentServerConfigRequest : AgentServerConfigModel, IRequest<string>, ITxRequest
    {
    }
}


/// <summary>
/// 校验
/// </summary>
public class AddAgentServerRequestValidator : AbstractValidator<AddOrEditAgentServerConfigRequest>
{
    /// <summary>
    /// 
    /// </summary>
    public AddAgentServerRequestValidator()
    {
        RuleFor(p => p.AgentServerId)
            .Must(p => !string.IsNullOrEmpty(p))
            .WithMessage("AgentServerId不能为空");

        RuleFor(p => p.ServerName)
            .Must(p => !string.IsNullOrEmpty(p))
            .WithMessage("ServerName不能为空");


        RuleFor(p => p.RootPath)
            .Must(p => !string.IsNullOrEmpty(p))
            .WithMessage("RootPath不能为空");
    }
}